// log_test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "..\include\ut_debug.h"
#include "time.h"
#include <omp.h>

//#pragma comment(lib, "logutil.lib")

using namespace utility::log;

int _tmain(int argc, _TCHAR* argv[])
{
#ifdef _DEBUG
    utility::log::CDebugSinkConsole::Instance()->ShowHeader(true);
    utility::log::CDebug::Instance()->SetSink(CDebugSinkWindows::Instance());
    utility::log::CDebug::Instance()->TurnOnDebugType(CDebug::e_DefaultType); 
    utility::log::CDebug::Instance()->EnableAllDebugLevel();
    CDebug::Instance()->DisableDebugLevel(CRITICAL);

#else
    // File logger.
    CDebugSinkFile::Instance()->SetFileDir("d:/");
    CDebugSinkFile::Instance()->ShowHeader(true);
    CDebugSinkFile::Instance()->SetFileHead("gs_");
    CDebugSinkFile::Instance()->SetFileTail(".log");
    CDebug::Instance()->SetSink(CDebugSinkFile::Instance());
    CDebug::Instance()->TurnOnDebugType(CDebug::e_DefaultType);
    CDebug::Instance()->EnableAllDebugLevel();
#endif

    omp_set_num_threads(4);
    DWORD t1 = GetTickCount();

//#pragma omp parallel for 
    for (int i = 0; i < 10000; i++)
        LOG(CRITICAL)<<"hello"<<' '<<123<< " " << i;
    LOG(DEFAULT)<<"world"<<' '<<123;

    DWORD t2 = GetTickCount();
    cout << t2 - t1<<endl;
    return 0;
}